<template>
	<view class="components-rules">
		<view class="rules-title" v-if="titleCopy">{{ titleCopy }}</view>
		<view class="rules-list">
			<block v-if="listCopy && listCopy.length !== 0" v-for="(item, index) in listCopy" :key="index">
				<view class="rules-item">
					{{ item }}
				</view>
			</block>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			title: {
				type: String,
				default: '',
			},
			list: {
				type: Array,
				default: function() {
					return [];
				},
			},
		},
		data() {
			return {
				titleCopy: this.title,
				listCopy: this.list,
			};
		},
		watch: {
			list(newVal, oldVal) {
				this.listCopy = newVal;
			},
		}
	}
</script>

<style scoped lang="scss">
	.components-rules {
		width: 690rpx;
		margin: 0 auto;
		padding: 40rpx 30rpx;
		background: #FFF;
		border-radius: 16rpx;
		
		.rules-title {
			color: #333333;
			font-size: 30rpx;
			font-weight: 500;
			margin-bottom: 30rpx;
			text-align: center;
		}
		
		.rules-list {
			color: #333333;
			font-size: 26rpx;
			line-height: 37rpx;
			.rules-item {
				margin-bottom: 20rpx;
				
				&:last-child {
					margin-bottom: 0;
				}
			}
		}
	}
</style>
